#include "stdio.h"
#include "string.h"

char ss[30000001],ins[50010000];
long int tab,stop;

void delblank(char s[50010000])
{
	long int len,i,j,b;
	b=1;
	while (b)
	{
		b=0;
		len=strlen(s);
		for (i=0;i<len;i++)
			if (s[i]==' '||s[i]==9)
			{
				for (j=i;j<=len;j++)
					s[j]=s[j+1];
				b=1;
				break;
			}
	}
	
}
int getstop(char s[50010000])
{
	long int len,i;
	len=strlen(s);
	for (i=0;i<len;i++)
	{
		if (s[i]=='{') stop++;
		else if (s[i]=='}') stop--;
	}
	return stop;
}


void main()
{

	long int i,j,len,chang,newline;
	char ch;
	
	scanf("%s",ins);

	stop=0;	
	tab=-4;


//	delblank(ins);
	getstop(ins);
	
	len=strlen(ins);
	for (i=0;i<len;i++)  ss[i]=ins[i];
	chang=len-1;

	if (stop)
	do {
		scanf("%s",ins);
//		delblank(ins);
		getstop(ins);

		len=strlen(ins);		
		for (i=0;i<len;i++)  
		{
			chang++;
			ss[chang]=ins[i];
		}		
	} while(stop);
	
/*	for (i=0;i<=chang;i++) printf("%c",ss[i]);	
	printf("\n\n\n");*/


	printf("{\n");
	tab=4;
	newline=1;
	for (i=1;i<=chang;i++)
	{
		ch=ss[i];
		if (newline) 
		{
			for (j=1;j<=tab;j++) printf(" ");
			newline=0;
		}
		if (ch=='{') 
		{
			tab+=4;			
			if (ss[i-1]!='{'&&ss[i-1]!=';') 
			printf(" %c\n",ch);
			else  printf("%c\n",ch);
			newline=1;
			if (ss[i+1]=='}') tab-=4;
		}
		else if (ch==',')
		{
			printf("%c ",ch);
		}
		else if (ch=='}')
		{			
			printf("%c",ch);
		}
		else if (ch==';')
		{
			printf("%c\n",ch);
			newline=1;
			if (ss[i+1]=='}'&&i!=chang) tab-=4;
		}
		else
			printf("%c",ch);
		if (i==chang) printf("\n");
	}

	

}
